import config from '@/config'
import http from '@/utils/request'

export default {
  ver: {
    url: `${config.API_URL}/demo/ver`,
    name: '获取最新版本号',
    get: async function (params) {
      //return await http.get(this.url, params)
      return {
        code: 200,
        data: '1.6.9',
        message: ''
      }
    }
  },
  post: {
    url: `${config.API_URL}/demo/post`,
    name: '分页列表',
    post: async function (data) {
      return await http.post(this.url, data, {
        headers: {
          //'response-status': 401
        }
      })
    }
  },
  page: {
    url: `${config.API_URL}/demo/page`,
    name: '分页列表',
    get: async function (params) {
      return await http.get(this.url, params)
    }
  },
  list: {
    url: `${config.API_URL}/demo/list`,
    name: '数据列表',
    get: async function (params) {
      // return await http.get(this.url, params)

      return {
        code: 200,
        data: {
          total: 5,
          page: 1,
          pageSize: 20,
          summary: {
            num: '999.00',
            progress: '888.00'
          },
          rows: [
            {
              id: '410000197812218565',
              name: 'David Davis',
              email: 'c.zirg@sxat.as',
              ip: '13.10.159.235',
              datetime: '2001-09-23 16:37:20',
              boolean: true,
              type: '0',
              sex: '男',
              progress: 86,
              num: 994
            },
            {
              id: '35000020200527412X',
              name: 'Linda Miller',
              email: 'f.gwtl@dzyxh.cz',
              ip: '46.232.191.1',
              datetime: '1998-07-26 19:25:20',
              boolean: true,
              type: '0',
              sex: '女',
              progress: 57,
              num: 976
            },
            {
              id: '370000200701101163',
              name: 'Brenda Lopez',
              email: 'o.usode@sqhecky.ml',
              ip: '205.115.8.81',
              datetime: '1991-08-27 18:19:09',
              boolean: false,
              type: '1',
              sex: '男',
              progress: 81,
              num: 81
            },
            {
              id: '340000199604137024',
              name: 'Sarah Martin',
              email: 'e.cujqawa@jzdeli.qa',
              ip: '221.80.170.254',
              datetime: '2022-09-13 09:31:55',
              boolean: true,
              type: '1',
              sex: '女',
              progress: 88,
              num: 959
            },
            {
              id: '310000200905184238',
              name: 'Edward Wilson',
              email: 'y.dtvq@lcojnz.pm',
              ip: '177.187.223.250',
              datetime: '1976-07-01 15:17:09',
              boolean: false,
              type: '0',
              sex: '女',
              progress: 3,
              num: 567
            }
          ]
        },
        message: ''
      }
    }
  },
  menu: {
    url: `${config.API_URL}/demo/menu`,
    name: '普通用户菜单',
    get: async function () {
      //  return await http.get(this.url)
      return {
        code: 200,
        data: {
          menu: [
            {
              name: 'home',
              path: '/home',
              meta: {
                title: '首页',
                icon: 'el-icon-eleme-filled',
                type: 'menu'
              },
              children: [
                {
                  name: 'dashboard',
                  path: '/dashboard',
                  meta: {
                    title: '控制台',
                    icon: 'el-icon-menu',
                    affix: true
                  },
                  component: 'home'
                },
                {
                  name: 'userCenter',
                  path: '/usercenter',
                  meta: {
                    title: '个人信息',
                    icon: 'el-icon-user'
                  },
                  component: 'userCenter'
                }
              ]
            },
            {
              name: 'other',
              path: '/other',
              meta: {
                title: '其他',
                icon: 'el-icon-more-filled',
                type: 'menu'
              },
              children: [
                {
                  path: '/other/directive',
                  name: 'directive',
                  meta: {
                    title: '指令',
                    icon: 'el-icon-price-tag',
                    type: 'menu'
                  },
                  component: 'other/directive'
                },
                {
                  path: '/other/viewTags',
                  name: 'viewTags',
                  meta: {
                    title: '标签操作',
                    icon: 'el-icon-files',
                    type: 'menu'
                  },
                  component: 'other/viewTags',
                  children: [
                    {
                      path: '/other/fullpage',
                      name: 'fullpage',
                      meta: {
                        title: '整页路由',
                        icon: 'el-icon-monitor',
                        fullpage: true,
                        hidden: true,
                        type: 'menu'
                      },
                      component: 'other/fullpage'
                    }
                  ]
                },
                {
                  path: '/link',
                  name: 'link',
                  meta: {
                    title: '外部链接',
                    icon: 'el-icon-link',
                    type: 'menu'
                  },
                  children: [
                    {
                      path: 'https://baidu.com',
                      name: '百度',
                      meta: {
                        title: '百度',
                        type: 'link'
                      }
                    },
                    {
                      path: 'https://www.google.cn',
                      name: '谷歌',
                      meta: {
                        title: '谷歌',
                        type: 'link'
                      }
                    }
                  ]
                },
                {
                  path: '/iframe',
                  name: 'Iframe',
                  meta: {
                    title: 'Iframe',
                    icon: 'el-icon-position',
                    type: 'menu'
                  },
                  children: [
                    {
                      path: 'https://v3.cn.vuejs.org',
                      name: 'vue3',
                      meta: {
                        title: 'VUE 3',
                        type: 'iframe'
                      }
                    },
                    {
                      path: 'https://element-plus.gitee.io',
                      name: 'elementplus',
                      meta: {
                        title: 'Element Plus',
                        type: 'iframe'
                      }
                    },
                    {
                      path: 'https://lolicode.gitee.io/scui-doc',
                      name: 'scuidoc',
                      meta: {
                        title: 'SCUI文档',
                        type: 'iframe'
                      }
                    }
                  ]
                }
              ]
            }
          ],
          permissions: ['list.add', 'list.edit', 'list.delete']
        },
        message: ''
      }
    }
  },
  status: {
    url: `${config.API_URL}/demo/status`,
    name: '模拟无权限',
    get: async function (code) {
      return await http.get(
        this.url,
        {},
        {
          headers: {
            'response-status': code
          }
        }
      )
    }
  }
}
